<?php

namespace App\Http\Controllers\Mobile;

use App\Services\Mobile\IndexService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class IndexController extends Controller
{
    private $indexService;
    public function __construct(IndexService $indexService)
    {
        $this->indexService = $indexService;
    }

    public function index(Request $request)
    {
        $originId = isset($request->id) ? intval($request->id) : session('originId');
        $products = $this->indexService->index($originId);
        return view('mobile.index', ['products' => $products]);
    }
}
